package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow.FlowFormEquipmentOfflineServerDetail;
import com.glsc.ngateway.common.base.domainmapper.FlowFormEquipmentOfflineServerDetailMapper;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.equipment.domainDto.FlowFormEquipmentOfflineServerDetailDto;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * FlowFormEquipmentOffline转换器
 * @author xuchang
 */
public class FlowFormEquipmentOfflineServerDetailConverter extends AbstractFlowFormDataConverter {
    public static FlowFormEquipmentOfflineServerDetailDto do2Dto(FlowFormEquipmentOfflineServerDetail detail) {
        if (Objects.isNull(detail)) {
            return null;
        }
        return FlowFormEquipmentOfflineServerDetailMapper.INSTANCE.domain2dto(detail);
    }

    public static List<FlowFormEquipmentOfflineServerDetailDto> do2Dto(List<FlowFormEquipmentOfflineServerDetail> detailList) {
        return CollectionUtils.isEmpty(detailList) ? java.util.Collections.emptyList() : detailList.stream().map(FlowFormEquipmentOfflineServerDetailConverter::do2Dto).collect(Collectors.toList());
    }

    public static FlowFormEquipmentOfflineServerDetail dto2Do(FlowFormEquipmentOfflineServerDetailDto detailDto) {
        if (Objects.isNull(detailDto)) {
            return null;
        }
        return FlowFormEquipmentOfflineServerDetailMapper.INSTANCE.dto2domain(detailDto);
    }

    public static List<FlowFormEquipmentOfflineServerDetail> dto2Do(List<FlowFormEquipmentOfflineServerDetailDto> detailDtoList) {
        return CollectionUtils.isEmpty(detailDtoList) ? java.util.Collections.emptyList() : detailDtoList.stream().map(FlowFormEquipmentOfflineServerDetailConverter::dto2Do).collect(Collectors.toList());
    }

}
